<!doctype html>
<html lang="en">

	<head>
		<meta charset="UTF-8" />
		<title>钛兑换购物券</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="css/mui.min.css" />
	</head>
	<style>
		.mui-input-group .mui-input-row:after{background: transparent;}
		.repeat {
			background: white;
			line-height: 60px;
		}
		
		.repeat p {
			font-size: 16px;
			padding: 0 28px;
			margin-bottom: 0;
		}
		.rpt-vice,.rpt-vice input {
			font-size: 14px;
		}
		.rpt-vice-btn{text-align: center;}
		.rpt-vice-btn button{width: 80%!important;margin: auto;float: none!important;}
	</style>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a href="javascript:history.go(-1)" class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">钛兑换消费</h1>
		</header>

		<div class="mui-content">
			<div class="repeat">
				<p>钛余额：<span>75.47</span></p>
			</div>
			<div class="rpt">
				<form class="mui-input-group" action="1">
				<ul class="mui-table-view">
					<li class="mui-table-view-cell">
						<div class="mui-input-row rpt-vice">
							<label>钛数量：</label>
							<input type="text" class="" id="one" placeholder="请输入钛数量">
						</div>
					</li>
					<li class="mui-table-view-cell">
						<div class="mui-input-row rpt-vice">
							<label>交易密码：</label>
							<input type="password" class="" id="pwd" placeholder="请输入交易密码">
						</div>
					</li>
					<li class="mui-table-view-cell">
						<div class="mui-input-row rpt-vice-btn">
							<button type="button" id="btn" class="mui-btn mui-btn-warning mui-btn-outlined">兑换</button>
						</div>
					</li>
				</ul>
				</form>
			</div>
		</div>

		<script src="js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/mui.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			mui.init()
			/*验证钛数量、交易密码*/
			var one = document.getElementById('one');
			var opwd = document.getElementById('pwd');
			var btn = document.getElementById('btn');
			var check = true;
			btn.onclick = function(){
				var reg = /^\d{2,5}$/;
				var rega = /^\d{6}$/;
				var onoe = one.value;
				var opwdo = opwd.value;
				if(onoe == ''){
					mui.toast("钛数量不能为空");
					check = false;
					return false;
				}
				if(!reg.test(onoe)){
					mui.toast("钛数量不能少于10");
					check = false;
					return false;
				}
				if(opwdo == ''){
					mui.toast("交易密码不能为空");
					check = false;
					return false;
				}
				if(!rega.test(opwdo)){
					mui.toast("交易密码不能少于6位数");
					check = false;
					return false;
				}
				if(check){
					$('form').submit()
				}
			}
			
		</script>
	</body>

</html>